package org.dromara.module.service;

import com.baomidou.mybatisplus.extension.service.IService;
import org.dromara.module.domain.ProductAttrValue;
import org.dromara.module.domain.ProductOrder;
import org.dromara.module.domain.WxUser;
import org.springframework.transaction.TransactionException;

import java.util.List;

/**
 * 订单Service接口
 *
 * @author Mr.Zhou
 * @date 2024-10-21
 */
public interface IProductOrderService extends IService<ProductOrder>{

    /**
     *  订单详情
     * @param orderId
     * @return
     */
    ProductOrder getOrderDetail(long orderId);

    /**
     *  立即购买
     * @param user
     * @param order_type
     * @param count
     * @param attrValue
     * @param remark
     * @return
     * @throws TransactionException
     */
    long buyNow(WxUser user, int order_type, int count, ProductAttrValue attrValue, String remark, String platform) throws TransactionException;


    /**
     * 买家查订单
     * @param userId
     * @param state
     * @param pageIndex
     * @param pageSize
     * @return
     */
    List<ProductOrder> queryListByUserId(int userId, int order_type, int state, int pageIndex, int pageSize);


    /**
     * 更新订单的状态
     * @return
     */
    int updateOrderState(ProductOrder order, int state);


    /**
     *  普通订单的 支付完成操作
     */
    int buyNormalUpdate(ProductOrder order, WxUser user);
}
